package com.itheima.springbootmybatis.dao;

import com.itheima.springbootmybatis.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Description:
 * @Version: V1.0
 */
@Mapper
public interface UserMapper {

    @Select("select * from t_user")
    public List<User> findAll();
    @Update("update t_user set username = #{username} where id = #{id}")
    public void update(User user);
    @Select("select * from t_user where id = #{id}")
    public User findById(Integer id);
    @Insert("insert into t_user(username,password) values (#{username},#{password})")
    public void insert(User user);
    @Delete("delete from t_user where id = #{id}")
    public void delete(Integer id);
}
